package com.study.usercenter.service;

import com.study.usercenter.entity.UserEntity;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserService {

    private static final Map<Integer, UserEntity> USER_LIST = new HashMap<>();

    static {
        USER_LIST.put(1, new UserEntity(1, "flwu", "wufaliang", "123456"));
        USER_LIST.put(2, new UserEntity(2, "lxia", "liuxia", "333333"));
    }

    public UserEntity userInfo(Integer id) {
        return USER_LIST.get(id);
    }

    public List<UserEntity> userList() {
        List<UserEntity> userList = new ArrayList<>(USER_LIST.values());
        return userList;
    }
}
